global
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

#---------------------------------------------------------------------
frontend web_service
   bind 0.0.0.0:80
   mode http
#   option forwardfor                    // 让后端服务器日志记录真实客户端地址
   default_backend web_servers
#   acl blog_acl hdr_reg(host) blog.
#   use_backend blog if blog_acl
   

#   default_backend opencart     // 定义默认后端，通过IP访问haproxy时默认为503 


backend web_servers
   balance roundrobin
   mode http
   server web1 192.168.2.40:80 check
   server web2 192.168.2.50:80 check
